<template>
	<view :data-theme="theme" :class="theme" :style="globalColor.style">
		<view class="card" v-if="type == 1 && fromData.workExperienceList && fromData.workExperienceList.length">
			<view class=" fboxRow Ycenter" @click="goPage('workExperience')">
				<view class="tit font34 flex1">工作经历</view>
				<view class="action-jiahao fboxRow Ycenter Xcenter"><text class="bwfont bw-jiahao font18"></text></view>
			</view>
			<view class="line"></view>
			<view class="con font26">
				<template v-if="fromData.workExperienceList && fromData.workExperienceList.length">
					<view v-for="(item, index) in fromData.workExperienceList" :key="index" @click="goPage('workExperience', index)">
						<view class="fboxRow Ycenter font30">
							<view class="flex1 font-ell1">
								<text v-if="item.department" class="text_marginR">{{ item.department }}</text>
								{{ item.position }}
							</view>
							<view class="action"><text class="bwfont bw-xiugai color-ACB4C7 font30"></text></view>
						</view>
						<view class="color-ACB4C7">{{ item.companyName }}</view>
						<view class="color-6B707C mt24">{{ item.gmtStartWork.replace('-', '.') }} - {{ item.gmtEndWork.replace('-', '.') }}</view>
						<view class="color-ACB4C7 lh44 mt24"><view style="white-space: pre-wrap;" v-html="item.jobContent"></view></view>
						<view class="line" v-if="index !== fromData.workExperienceList.length - 1"></view>
					</view>
				</template>
				<text v-else class="color-6B707C" @click="goPage('workExperience')">添加工作经历</text>
			</view>
		</view>
		<view class="card" v-if="type == 2 && !(fromData.workExperienceList && fromData.workExperienceList.length)">
			<view class=" fboxRow Ycenter" @click="goPage('workExperience')">
				<view class="tit font34 flex1">工作经历</view>
				<view class="action-jiahao fboxRow Ycenter Xcenter"><text class="bwfont bw-jiahao font18"></text></view>
			</view>
			<view class="line"></view>
			<view class="con font26"><text class="color-6B707C" @click="goPage('workExperience')">添加工作经历</text></view>
		</view>
		<view class="card" v-if="type == 1 && fromData.projectExperienceList && fromData.projectExperienceList.length">
			<view class=" fboxRow Ycenter" @click="goPage('projectExperience')">
				<view class="tit font34 flex1">项目经历</view>
				<view class="action-jiahao fboxRow Ycenter Xcenter"><text class="bwfont bw-jiahao font18"></text></view>
			</view>
			<view class="line"></view>
			<view class="con">
				<template v-if="fromData.projectExperienceList && fromData.projectExperienceList.length">
					<view v-for="(item, index) in fromData.projectExperienceList" :key="index" @click="goPage('projectExperience', index)">
						<view class="fboxRow Ycenter font30">
							<view class="flex1 font-ell1">{{ item.position }}</view>
							<view class="action"><text class="bwfont bw-xiugai color-ACB4C7 font30"></text></view>
						</view>
						<view class="color-ACB4C7">{{ item.projectName }}</view>
						<view class="color-6B707C mt24">{{ item.gmtStartWork.replace('-', '.') }} - {{ item.gmtEndWork.replace('-', '.') }}</view>
						<view class="color-ACB4C7 lh44 mt24"><view style="white-space: pre-wrap;" v-html="item.projectDescription"></view></view>
						<view class="line" v-if="index !== fromData.projectExperienceList.length - 1"></view>
					</view>
				</template>
			</view>
		</view>
		<view class="card" v-if="type == 2 && !(fromData.projectExperienceList && fromData.projectExperienceList.length)">
			<view class=" fboxRow Ycenter" @click="goPage('projectExperience')">
				<view class="tit font34 flex1">项目经历</view>
				<!-- <view class="action"><u-icon name="plus-circle" size="32rpx" color="#98979C"></u-icon></view> -->
				<view class="action-jiahao fboxRow Ycenter Xcenter"><text class="bwfont bw-jiahao font18"></text></view>
			</view>
			<view class="line"></view>
			<view class="con"><text class="color-6B707C" @click="goPage('projectExperience')">填写项目经历</text></view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		fromData: {
			type: Object,
			default: () => {
				return {};
			}
		},
		type: {
			type: String,
			default: '1' // 1 | 2
		}
	},
	data() {
		return {
			theme: getApp().globalData.appTheme,
			globalColor: getApp().globalData.globalColor
		};
	},
	methods: {
		goPage(path, i) {
			getApp().globalData.vitaTemp = this.fromData;
			if (path == 'workExperience') {
				let parma = '';
				if (typeof i != 'undefined') {
					getApp().globalData.workExperience = this.fromData.workExperienceList[i];
					parma = '?index=' + i + '&isCon=1';
				} else {
					getApp().globalData.workExperience = {};
					parma = '?isCon=0';
				}
				this.$pageTo('/recruit/user/vita-workExperience' + parma);
			} else if (path == 'projectExperience') {
				let parma = '';
				if (typeof i != 'undefined') {
					getApp().globalData.projectExperience = this.fromData.projectExperienceList[i];
					parma = '?index=' + i + '&isCon=1';
				} else {
					getApp().globalData.projectExperience = {};
					parma = '?isCon=0';
				}
				this.$pageTo('/recruit/user/vita-projectExperience' + parma);
			} else if (path == 'view') {
				if (this.fromData.id) {
					this.$pageTo('/recruit/user/detail?pageType=0&id=' + this.fromData.id);
				} else {
					uni.showToast({
						icon: 'none',
						title: '请完善你的简历'
					});
				}
			} else if (path) {
				this.$pageTo(path);
			} else {
				this.$pageTo('/recruit/user/detail?pageType=0&id=' + this.fromData.id);
			}
		}
	}
};
</script>

<style lang="scss" scoped>
.wrap {
	padding: 32rpx 40rpx;
}
.text_marginR {
	margin-right: 20rpx;
}
.card {
	padding: 32rpx;
	margin-bottom: 24rpx;
	background-color: var(--viewBgColor);
	border-radius:12rpx
}
.action-jiahao{width: 32rpx;height: 32rpx;overflow: hidden;border: 1px solid var(--contentFontFourColor);color: var(--contentFontFourColor);border-radius: 50%;}
.userInfo .avatar {
	margin-right: 24rpx;
	width: 100rpx;
	height: 100rpx;
	border: 2rpx solid #f7f9ff;
	border-radius: 50%;
	overflow: hidden;
}

.userInfo .name {
	line-height: 50rpx;
}

.userInfo .age {
	line-height: 44rpx;
}

.tags {
}

.tags .tag {
	margin: 16rpx 16rpx 16rpx 0;
	padding: 0 12rpx;
	height: 48rpx;
	border-radius: 8rpx;
}

.btn-group {
	border-radius: 8rpx;
	overflow: hidden;
}

.btn-group .btn {
	padding: 0 12rpx;
	height: 48rpx;
}

.more-item {
	height: 70rpx;
	margin-bottom: 24rpx;
}

.card .con {
	line-height: 38rpx;
}

.line {
	margin: 32rpx 0;
	height: 1rpx;
	background: var(--backgroundDivisionColor);
}

.fixed-space {
	height: 142rpx;
}

.fixed-btn {
	position: fixed;
	left: 0;
	bottom: 0;
	right: 0;
	padding: 24rpx 0 66rpx;
	height: 166rpx;
}

.fixed-btn .btn {
	width: 570rpx;
	height: 76rpx;
	border-radius: 12rpx;
}
</style>
